//
//  SEPlanet.h
//  Space Explorer
//
//  Created by Yann Blaudin de Thé on 05/04/13.
//  Copyright (c) 2013 TeaTime. All rights reserved.
//

#ifndef SE_PLANET_H_
#define SE_PLANET_H_

#include "SEOrbitalElements.h"
#include "SEClock.h"
#include "SESpiceManager.h"
#include "SEPrimitives.h"
#include "SEMisc.h"


class SEPlanet {
private:
    irr::core::stringw _nom_aff;
    std::string _nom_spice;
    
    SESpice::Object _spice_object;
    
    irr::scene::IMeshSceneNode *_irr_ground_node;
    
    irr::IrrlichtDevice *_irr_device;
    
    vec3d _position, _velocity;
    
    SpiceDouble _Req, _Rpo, _GM;
    
    SEOrbitalElements _orb_elem;
    
    SEPlanet* _attractor;
    
public:
    SEPlanet(irr::IrrlichtDevice *device, SEPlanet* attractor, const irr::core::stringw& disp_name, const std::string& spice_name, irr::video::ITexture* ground_tex, irr::video::ITexture* cloud_tex, irr::video::ITexture* normal_tex);
    ~SEPlanet();
    
    void update(SEClock &ck, const vec3d& cam_pos);
    
    SpiceDouble getPolarRadius() const;
    
    SpiceDouble getEquatorialRadius() const;
    
    vec3f getIrrPosition() const;
    
    vec3d getPosition() const;
    
    vec3d geocg2geod(vec3d pos);
    
    vec3d geod2geocg(irr::f32 lat, irr::f32 lon, irr::f32 alt);
    
    irr::scene::IMeshSceneNode* getIrrNode();
    
    SEOrbitalElements* getOrbitalElements();
    
    std::string getName() const;
    
    SpiceDouble getGravitationalParameter() const;
    
    SpiceDouble getSphereOfInfluence() const;
    
};


#endif /* defined(SE_PLANET_H_) */
